home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
et
/
et3_0-a1.lha
/
et3
/
src
/
ShellTView.h
< prev
next >
Wrap
C/C++ Source or Header
|
1992-06-29
|
3KB
|
110 lines
#ifndef ShellTView_First
#ifdef __GNUG__
//pragma once
#pragma interface
#endif
#define ShellTView_First
#include "TextView.h"
#include "PttyConnection.h"
#include "CmdNo.h"
extern Rectangle gShellTextViewRect;
extern char *gDefaultArgv[];
//---- ShellTextView --------------------------------------------------------
// a TextView connected to a ptty running a shell
class ShellTextView: public TextView {
public:
MetaDef(ShellTextView);
ShellTextView(
EvtHandler *eh, Rectangle r, Text *t,
char *name= 0, char **args= 0, bool becomeconsole= FALSE,
TextViewFlags= eTextViewDefault, Point border= gBorder
);
~ShellTextView();
virtual char *GetTermCap();
virtual char *GetTerm();
virtual void BecomeConsole();
virtual void Received();
virtual void Submit(char *buf, int size);
virtual void SubmitInterrupt(char c);
virtual bool IsIdle();
virtual void Reconnect();
virtual void Start(char *name= 0, char **args= 0, bool becomeconsole= FALSE);
virtual void Done();
virtual void SlaveDied();
virtual void CleanupDeath();
virtual Command *CntrlChar(byte b);
virtual void DoReveal(bool);
virtual void RevealOutput(Rectangle r, Point p);
void Draw(Rectangle); // draw output cursor
Text *SetText(Text *, bool scroll= cRevealTop); // returns old text
void SetTtySize(int rows, int cols);
void SetTtySize(Rectangle r, Font *fd);
void ChangedViewRect(Rectangle r);
char **GetArgv();
class PttyConnection *GetPtty();
void ClearOutput();
void Doit();
void SetMaxLogSize(int n);
Command *TtyInput(char *buf, int len= -1); // appends buf to ttys input queue
//---- overridden to maintain a fence of read only text
bool DeleteRequest(int from, int to);
void Paste(Text *insert);
//---- controller methods
Command *DoKeyCommand(int, Token);
static Menu* MakeMenu(int menuId);
void DoSetupMenu(class Menu *);
Command *DoMenuCommand(int);
void SelectAll(bool redraw);
//---- input/output
OStream& PrintOn(OStream&);
IStream& ReadFrom(IStream&);
protected:
class GapText *noEchoBuffer; // used when echo is turned off
int lastSubmit;
int maxLogSize;
int state; // for interpreting ESC-Sequences
bool pendingCR;
PttyChars pttyc; // tty-chararacters that submit a command
char *pttycstr;
char **argv;
byte *linebuf;
void Init(bool doReveal, char *name, char **argv, bool cons);
void Term();
bool ModifiesReadOnly();
void Wrap();
void BackSpace(Text *t, int n);
void CarriageReturn(Text *t);
void MarksToEOT();
void DrawOutputCursor(Point p);
void FlushPendingInput();
bool HandleSpecialOutChar(char p, class GapText *);
virtual void ProcessOutput(GapText *t, char *buf, int size);
virtual void InsertReceivedText(Text *t, int from, int to);
private:
class PttyInputHandler *pttyinp;
class ShellZombieHandler *zombieHandler;
class PttyConnection *pttycon;
class Mark *outputCursor, *inputCursor;
class OrdCollection *inpQueue;
bool doReveal;
bool inReceive;
};
#endif